package com.woniu.model.gh.utils;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;

public class MailUtil {

    //发送邮件：收件人，标题，内容
    public static void sendTxtEmail(String targetMail,String title,String content){

        //sender
        JavaMailSenderImpl sender = new JavaMailSenderImpl();
        sender.setHost("smtp.qq.com");
        sender.setPort(465);//5672
        sender.setUsername("1012906681@qq.com");
        sender.setPassword("uaoumijtbmdlbdgd");
        sender.setDefaultEncoding("UTF-8");

        //mail
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("1012906681@qq.com");
        message.setTo(targetMail);
        message.setSubject(title);//标题
        message.setText(content);//内容

        //send
        sender.send(message);
    }

}
